//2009/08/26 15:38:29
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <queue>
#include <sstream>
#include <algorithm>

using namespace std;

class ContiguousSubsequences
{
public:
    vector <int> findMaxAverage(vector <int> a, int K)
    {
		double aver = 0.0;
		int idx = -1;
		int idy = -1;
		for(int i=0; i<a.size(); i++)
		{
			double total = 0.0;
			for(int j=i; j<a.size(); j++) total += 1.0 * a[j];
			for(int j=a.size() -1; j-i + 1>=K; j--)
			{
				if(j - i + 1 >= K)
				{
					double temp = total / (j-i+1);
					if(temp > aver || (temp == aver && j-i>idy-idx) || (aver ==0.0 && idx ==-1 && idy==-1))
					{
						aver = temp;
						idx =i;
						idy =j;
					}
				}
				total -= 1.0 * a[j];
			}
		}
		vector<int> ret;
		ret.push_back(idx);
		ret.push_back(idy);
		return ret;
    }
};
